{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>holiday_0</th>\n",
       "      <th>holiday_1</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_3</th>\n",
       "      <th>weekday_4</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>casual</th>\n",
       "      <th>log_casual</th>\n",
       "      <th>registered</th>\n",
       "      <th>log_registered</th>\n",
       "      <th>cnt</th>\n",
       "      <th>log_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>-0.826662</td>\n",
       "      <td>-0.679946</td>\n",
       "      <td>1.250171</td>\n",
       "      <td>-0.387892</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>331</td>\n",
       "      <td>5.805135</td>\n",
       "      <td>654</td>\n",
       "      <td>6.484635</td>\n",
       "      <td>985</td>\n",
       "      <td>6.893656</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>-0.721095</td>\n",
       "      <td>-0.740652</td>\n",
       "      <td>0.479113</td>\n",
       "      <td>0.749602</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>131</td>\n",
       "      <td>4.882802</td>\n",
       "      <td>670</td>\n",
       "      <td>6.508769</td>\n",
       "      <td>801</td>\n",
       "      <td>6.687109</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>-1.634657</td>\n",
       "      <td>-1.749767</td>\n",
       "      <td>-1.339274</td>\n",
       "      <td>0.746632</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>120</td>\n",
       "      <td>4.795791</td>\n",
       "      <td>1229</td>\n",
       "      <td>7.114769</td>\n",
       "      <td>1349</td>\n",
       "      <td>7.207860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>-1.614780</td>\n",
       "      <td>-1.610270</td>\n",
       "      <td>-0.263182</td>\n",
       "      <td>-0.389829</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>108</td>\n",
       "      <td>4.691348</td>\n",
       "      <td>1454</td>\n",
       "      <td>7.282761</td>\n",
       "      <td>1562</td>\n",
       "      <td>7.354362</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>-1.467414</td>\n",
       "      <td>-1.504971</td>\n",
       "      <td>-1.341494</td>\n",
       "      <td>-0.046307</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>82</td>\n",
       "      <td>4.418841</td>\n",
       "      <td>1518</td>\n",
       "      <td>7.325808</td>\n",
       "      <td>1600</td>\n",
       "      <td>7.378384</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       temp     atemp       hum  windspeed  weathersit_1  weathersit_2  \\\n",
       "0 -0.826662 -0.679946  1.250171  -0.387892             0             1   \n",
       "1 -0.721095 -0.740652  0.479113   0.749602             0             1   \n",
       "2 -1.634657 -1.749767 -1.339274   0.746632             1             0   \n",
       "3 -1.614780 -1.610270 -0.263182  -0.389829             1             0   \n",
       "4 -1.467414 -1.504971 -1.341494  -0.046307             1             0   \n",
       "\n",
       "   weathersit_3  holiday_0  holiday_1  workingday_0  ...  weekday_3  \\\n",
       "0             0          1          0             1  ...          0   \n",
       "1             0          1          0             1  ...          0   \n",
       "2             0          1          0             0  ...          0   \n",
       "3             0          1          0             0  ...          0   \n",
       "4             0          1          0             0  ...          1   \n",
       "\n",
       "   weekday_4  weekday_5  weekday_6  casual  log_casual  registered  \\\n",
       "0          0          0          1     331    5.805135         654   \n",
       "1          0          0          0     131    4.882802         670   \n",
       "2          0          0          0     120    4.795791        1229   \n",
       "3          0          0          0     108    4.691348        1454   \n",
       "4          0          0          0      82    4.418841        1518   \n",
       "\n",
       "   log_registered   cnt   log_cnt  \n",
       "0        6.484635   985  6.893656  \n",
       "1        6.508769   801  6.687109  \n",
       "2        7.114769  1349  7.207860  \n",
       "3        7.282761  1562  7.354362  \n",
       "4        7.325808  1600  7.378384  \n",
       "\n",
       "[5 rows x 24 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np  #矩阵操作\n",
    "import pandas as pd #数据处理\n",
    "from sklearn.metrics import r2_score #评价回归模型性能\n",
    "import matplotlib.pyplot as plt #画图\n",
    "import seaborn as sns\n",
    "\n",
    "df_day = pd.read_csv('Bike-Sharing-Dataset/FE_day.csv')\n",
    "df_day.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>weathersit_1</th>\n",
       "      <th>weathersit_2</th>\n",
       "      <th>weathersit_3</th>\n",
       "      <th>holiday_0</th>\n",
       "      <th>holiday_1</th>\n",
       "      <th>workingday_0</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_0</th>\n",
       "      <th>weekday_1</th>\n",
       "      <th>weekday_2</th>\n",
       "      <th>weekday_3</th>\n",
       "      <th>weekday_4</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>log_casual</th>\n",
       "      <th>log_registered</th>\n",
       "      <th>log_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>-0.826662</td>\n",
       "      <td>-0.679946</td>\n",
       "      <td>1.250171</td>\n",
       "      <td>-0.387892</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>5.805135</td>\n",
       "      <td>6.484635</td>\n",
       "      <td>6.893656</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>-0.721095</td>\n",
       "      <td>-0.740652</td>\n",
       "      <td>0.479113</td>\n",
       "      <td>0.749602</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4.882802</td>\n",
       "      <td>6.508769</td>\n",
       "      <td>6.687109</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>-1.634657</td>\n",
       "      <td>-1.749767</td>\n",
       "      <td>-1.339274</td>\n",
       "      <td>0.746632</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4.795791</td>\n",
       "      <td>7.114769</td>\n",
       "      <td>7.207860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>-1.614780</td>\n",
       "      <td>-1.610270</td>\n",
       "      <td>-0.263182</td>\n",
       "      <td>-0.389829</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4.691348</td>\n",
       "      <td>7.282761</td>\n",
       "      <td>7.354362</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>-1.467414</td>\n",
       "      <td>-1.504971</td>\n",
       "      <td>-1.341494</td>\n",
       "      <td>-0.046307</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4.418841</td>\n",
       "      <td>7.325808</td>\n",
       "      <td>7.378384</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       temp     atemp       hum  windspeed  weathersit_1  weathersit_2  \\\n",
       "0 -0.826662 -0.679946  1.250171  -0.387892             0             1   \n",
       "1 -0.721095 -0.740652  0.479113   0.749602             0             1   \n",
       "2 -1.634657 -1.749767 -1.339274   0.746632             1             0   \n",
       "3 -1.614780 -1.610270 -0.263182  -0.389829             1             0   \n",
       "4 -1.467414 -1.504971 -1.341494  -0.046307             1             0   \n",
       "\n",
       "   weathersit_3  holiday_0  holiday_1  workingday_0  ...  weekday_0  \\\n",
       "0             0          1          0             1  ...          0   \n",
       "1             0          1          0             1  ...          1   \n",
       "2             0          1          0             0  ...          0   \n",
       "3             0          1          0             0  ...          0   \n",
       "4             0          1          0             0  ...          0   \n",
       "\n",
       "   weekday_1  weekday_2  weekday_3  weekday_4  weekday_5  weekday_6  \\\n",
       "0          0          0          0          0          0          1   \n",
       "1          0          0          0          0          0          0   \n",
       "2          1          0          0          0          0          0   \n",
       "3          0          1          0          0          0          0   \n",
       "4          0          0          1          0          0          0   \n",
       "\n",
       "   log_casual  log_registered   log_cnt  \n",
       "0    5.805135        6.484635  6.893656  \n",
       "1    4.882802        6.508769  6.687109  \n",
       "2    4.795791        7.114769  7.207860  \n",
       "3    4.691348        7.282761  7.354362  \n",
       "4    4.418841        7.325808  7.378384  \n",
       "\n",
       "[5 rows x 21 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_casual = df_day['casual']\n",
    "y_registered = df_day['registered']\n",
    "y_cnt = df_day['cnt']\n",
    "x = df_day.drop(['casual','registered','cnt'],axis = 1)\n",
    "x.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['temp', 'atemp', 'hum', 'windspeed', 'weathersit_1', 'weathersit_2',\n",
      "       'weathersit_3', 'holiday_0', 'holiday_1', 'workingday_0',\n",
      "       'workingday_1', 'weekday_0', 'weekday_1', 'weekday_2', 'weekday_3',\n",
      "       'weekday_4', 'weekday_5', 'weekday_6', 'log_casual', 'log_registered',\n",
      "       'log_cnt'],\n",
      "      dtype='object')\n"
     ]
    }
   ],
   "source": [
    "feat_names = x.columns\n",
    "print(feat_names)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(584, 21)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#分离除部分数据用来测试\n",
    "from sklearn.model_selection import train_test_split\n",
    "#使用20%的数据作为测试\n",
    "x_train,x_test,y_train,y_test = train_test_split(x,y_cnt,random_state = 33,test_size = 0.2)\n",
    "x_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>20</td>\n",
       "      <td>log_cnt</td>\n",
       "      <td>2450.468974</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>6</td>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>907.323457</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>19</td>\n",
       "      <td>log_registered</td>\n",
       "      <td>299.548489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>18</td>\n",
       "      <td>log_casual</td>\n",
       "      <td>193.744087</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>temp</td>\n",
       "      <td>148.470881</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>12</td>\n",
       "      <td>weekday_1</td>\n",
       "      <td>64.319952</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>14</td>\n",
       "      <td>weekday_3</td>\n",
       "      <td>60.444030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17</td>\n",
       "      <td>weekday_6</td>\n",
       "      <td>48.565092</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>10</td>\n",
       "      <td>workingday_1</td>\n",
       "      <td>38.199271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>8</td>\n",
       "      <td>holiday_1</td>\n",
       "      <td>33.108645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>atemp</td>\n",
       "      <td>-8.366413</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>16</td>\n",
       "      <td>weekday_5</td>\n",
       "      <td>-9.270087</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>13</td>\n",
       "      <td>weekday_2</td>\n",
       "      <td>-17.576071</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>15</td>\n",
       "      <td>weekday_4</td>\n",
       "      <td>-26.609906</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>windspeed</td>\n",
       "      <td>-32.633695</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>7</td>\n",
       "      <td>holiday_0</td>\n",
       "      <td>-33.108645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>workingday_0</td>\n",
       "      <td>-38.199271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>hum</td>\n",
       "      <td>-64.662160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>weekday_0</td>\n",
       "      <td>-119.873009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>-407.409636</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>-499.913821</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           columns         coef\n",
       "20         log_cnt  2450.468974\n",
       "6     weathersit_3   907.323457\n",
       "19  log_registered   299.548489\n",
       "18      log_casual   193.744087\n",
       "0             temp   148.470881\n",
       "12       weekday_1    64.319952\n",
       "14       weekday_3    60.444030\n",
       "17       weekday_6    48.565092\n",
       "10    workingday_1    38.199271\n",
       "8        holiday_1    33.108645\n",
       "1            atemp    -8.366413\n",
       "16       weekday_5    -9.270087\n",
       "13       weekday_2   -17.576071\n",
       "15       weekday_4   -26.609906\n",
       "3        windspeed   -32.633695\n",
       "7        holiday_0   -33.108645\n",
       "9     workingday_0   -38.199271\n",
       "2              hum   -64.662160\n",
       "11       weekday_0  -119.873009\n",
       "4     weathersit_1  -407.409636\n",
       "5     weathersit_2  -499.913821"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "#使用线性回归训练模型获取结果\n",
    "lr = LinearRegression()\n",
    "lr.fit(x_train,y_train)\n",
    "y_test_pre = lr.predict(x_test)\n",
    "y_train_pre = lr.predict(x_train)\n",
    "#看各个特征的权重系数\n",
    "fs = pd.DataFrame({\"columns\":list(feat_names),\"coef\":list((lr.coef_.T))})\n",
    "fs.sort_values(by = ['coef'],ascending = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r2 test 0.8655229149530934\n",
      "r2 train 0.8633986001887001\n"
     ]
    }
   ],
   "source": [
    "#使用r2_score评估测试和训练的性能\n",
    "print('r2 test',r2_score(y_test,y_test_pre))\n",
    "print('r2 train', r2_score(y_train,y_train_pre))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r2 test 720.0642691833897\n",
      "r2 train 712.7318556517981\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import mean_squared_error\n",
    "print('r2 test',np.sqrt(mean_squared_error(y_test,y_test_pre)))\n",
    "print('r2 train', np.sqrt(mean_squared_error(y_train,y_train_pre)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r2 test 720.0642691833897\n",
      "r2 train 712.7318556517981\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import RidgeCV\n",
    "\n",
    "#设置超参数搜索范围\n",
    "alphas = [0.01,0.1,1,10,100]\n",
    "#生成实例\n",
    "ridge = RidgeCV(alphas = alphas, store_cv_values = True)\n",
    "ridge.fit(x_train,y_train)\n",
    "y_test_pre_ridge = ridge.predict(x_test)\n",
    "y_train_pre_ridge = ridge.predict(x_train)\n",
    "print('r2 test',np.sqrt(mean_squared_error(y_test,y_test_pre)))\n",
    "print('r2 train', np.sqrt(mean_squared_error(y_train,y_train_pre)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEGCAYAAACpXNjrAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXzU1b3/8deHLIR9DZFVQBBEFISIiopVRHHFDdS2V9ra6+2i3e69rW1/t3a9t6tebdXe1qXa2krADXcBd63IIAiyKBGXhCUJW1hDQvL5/TEnOOAQQpjJTCbv5+Mxj8yc7/l+5zNflk++53znc8zdERERSaQ2qQ5AREQyj5KLiIgknJKLiIgknJKLiIgknJKLiIgkXHaqA0gXPXv29IEDB6Y6DB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YFLofyVwW0z/CHD6oX9UkYapcKVI4pxGtDpwLVBmZi8BJ4b2me5eB6w3sxdi9ukNVMS8nhaWQcgO20YQLdkRqw6YEZ7/DYgtQlj/fCHRhAaQA/zBzEYDtcDRMf3LiZbhEUkoJReRxDnQwl0NLei1i2jNMMxsEPAfwInuvtnM/lK/7SBiazjtDj9r+eTf97eJ1nQbRXS0oiqmf16IQSShNCwmkjgvA1eaWVaYB5lAtMDkq0QX02pjZgVEl7mttwIYEp53BnYAlaHfeQd4nzZEqyIDfDYcvyFdgHXhyulfiC5dXO9o0qMqtmQYXbmIJM4jROdT3iZ6NfFdd19vZg8BE4n+J/4e0RUAK8M+TxJNNnPd/W0zW0S0Yu5q4LUDvM8O4FgzWxiOc+VB4roDeMjMphKtWrwjZtuZIQaRhFJVZJFmYGYdPbryYA+iVzOnhsTTjuh/+KeGuZrGHGu7u3dMUFwvA1PcfXMijidST1cuIs3jCTPrCuQCP3P39QDuvsvMbiK6VvnHzRlQGLq7WYlFkkFXLiIiknCa0BcRkYRTchERkYRTchERkYRTchERkYRTchERkYT7/yqNSf/LALaXAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is 10.0\n"
     ]
    }
   ],
   "source": [
    "mse_mean = np.mean(ridge.cv_values_,axis = 0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1))\n",
    "\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "print('alpha is',ridge.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>20</td>\n",
       "      <td>log_cnt</td>\n",
       "      <td>2450.468974</td>\n",
       "      <td>1177.204024</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>6</td>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>907.323457</td>\n",
       "      <td>526.180339</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>19</td>\n",
       "      <td>log_registered</td>\n",
       "      <td>299.548489</td>\n",
       "      <td>1159.294001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>18</td>\n",
       "      <td>log_casual</td>\n",
       "      <td>193.744087</td>\n",
       "      <td>427.929591</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>temp</td>\n",
       "      <td>148.470881</td>\n",
       "      <td>109.382039</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>12</td>\n",
       "      <td>weekday_1</td>\n",
       "      <td>64.319952</td>\n",
       "      <td>32.047768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>14</td>\n",
       "      <td>weekday_3</td>\n",
       "      <td>60.444030</td>\n",
       "      <td>73.461370</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17</td>\n",
       "      <td>weekday_6</td>\n",
       "      <td>48.565092</td>\n",
       "      <td>47.551855</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>10</td>\n",
       "      <td>workingday_1</td>\n",
       "      <td>38.199271</td>\n",
       "      <td>54.693586</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>8</td>\n",
       "      <td>holiday_1</td>\n",
       "      <td>33.108645</td>\n",
       "      <td>7.936456</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>atemp</td>\n",
       "      <td>-8.366413</td>\n",
       "      <td>43.957278</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>16</td>\n",
       "      <td>weekday_5</td>\n",
       "      <td>-9.270087</td>\n",
       "      <td>-30.003288</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>13</td>\n",
       "      <td>weekday_2</td>\n",
       "      <td>-17.576071</td>\n",
       "      <td>-4.597720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>15</td>\n",
       "      <td>weekday_4</td>\n",
       "      <td>-26.609906</td>\n",
       "      <td>-8.278089</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>windspeed</td>\n",
       "      <td>-32.633695</td>\n",
       "      <td>-31.558271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>7</td>\n",
       "      <td>holiday_0</td>\n",
       "      <td>-33.108645</td>\n",
       "      <td>-7.936456</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>workingday_0</td>\n",
       "      <td>-38.199271</td>\n",
       "      <td>-54.693586</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>hum</td>\n",
       "      <td>-64.662160</td>\n",
       "      <td>-45.152108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>weekday_0</td>\n",
       "      <td>-119.873009</td>\n",
       "      <td>-110.181896</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>-407.409636</td>\n",
       "      <td>-200.491885</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>-499.913821</td>\n",
       "      <td>-325.688454</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           columns      coef_lr   coef_ridge\n",
       "20         log_cnt  2450.468974  1177.204024\n",
       "6     weathersit_3   907.323457   526.180339\n",
       "19  log_registered   299.548489  1159.294001\n",
       "18      log_casual   193.744087   427.929591\n",
       "0             temp   148.470881   109.382039\n",
       "12       weekday_1    64.319952    32.047768\n",
       "14       weekday_3    60.444030    73.461370\n",
       "17       weekday_6    48.565092    47.551855\n",
       "10    workingday_1    38.199271    54.693586\n",
       "8        holiday_1    33.108645     7.936456\n",
       "1            atemp    -8.366413    43.957278\n",
       "16       weekday_5    -9.270087   -30.003288\n",
       "13       weekday_2   -17.576071    -4.597720\n",
       "15       weekday_4   -26.609906    -8.278089\n",
       "3        windspeed   -32.633695   -31.558271\n",
       "7        holiday_0   -33.108645    -7.936456\n",
       "9     workingday_0   -38.199271   -54.693586\n",
       "2              hum   -64.662160   -45.152108\n",
       "11       weekday_0  -119.873009  -110.181896\n",
       "4     weathersit_1  -407.409636  -200.491885\n",
       "5     weathersit_2  -499.913821  -325.688454"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fs = pd.DataFrame({\"columns\":list(feat_names),\"coef_lr\":list((lr.coef_.T)),\"coef_ridge\":list((ridge.coef_.T))})\n",
    "fs.sort_values(by = ['coef_lr'],ascending = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/jay/opt/anaconda3/lib/python3.7/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.\n",
      "  warnings.warn(CV_WARNING, FutureWarning)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r2 test 720.0642691833897\n",
      "r2 train 712.7318556517981\n"
     ]
    }
   ],
   "source": [
    "#Lasso  L1正则\n",
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "#使用默认的alpha\n",
    "lasso = LassoCV()\n",
    "lasso.fit(x_train,y_train)\n",
    "y_test_pre_lasso = lasso.predict(x_test)\n",
    "y_train_pre_lasso = lasso.predict(x_train)\n",
    "print('r2 test',np.sqrt(mean_squared_error(y_test,y_test_pre)))\n",
    "print('r2 train', np.sqrt(mean_squared_error(y_train,y_train_pre)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ4AAAEGCAYAAABVSfMhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3df3xU9Z3v8ddnJgkgv38E5JfyK6hIETBS1Hq1ahVtb2m9WnW3lXrt2u3qo+3e/VHbvbdu2919tLvbuutua9eurthq0aqt1B91qWJ1XUVjBIEiEEFCIEAgIeF3kpnP/WO+A0NMSIKZOZnM+/l4zCNnvud7zvkcR+Y958x3zjF3R0REJFdiURcgIiKFRcEjIiI5peAREZGcUvCIiEhOKXhERCSniqIuoLcbNWqUT5o0KeoyRETyyptvvrnb3Uvbm6fg6cSkSZOoqKiIugwRkbxiZls6mqdTbSIiklMKHhERySkFj4iI5JSCR0REckrBIyIiOaXgERGRnFLwiIhITil4RETkff7ptxt4pWp3Vtat4BERkeM0HW7hn5/fSMV7DVlZv4JHRESOs2rrXtxh7unDsrJ+BY+IiByncstezGD2RAWPiIjkQGV1A9NHD2Zw/+KsrF/BIyIiRyWTzlvVDcw5LTtHO6DgERGRDJt276fpcCtzTxuetW0oeERE5KjKLXuB7A0sAAWPiIhkeGtrA0P6Fz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Zt83s0oze97MSjNmXxfu27LBzC4K/SeZ2cuhf6WZXZDR/1ehBpEep+ARyb5rgNnAOaQuafIP4fJF1wCTgA8BXwDOz1jmQuDNjOd/5e7lwCzgYjOb1c52BgKV7j4X+B2pqySkFbn7POCrGe27gI+F/tcDd2f0rwAu6v6uinROl8wRyb6PAD939wSw08x+B5wX2n/h7klgh5ktz1hmLFCX8fwzZnYrqX+zY4EZwNtttpMEHgnTPwMyL36Znn6TVNhB6tI9/2pms4EEMD2j/y5gXDf3U6RLFDwi2dfRTbdOdDOuQ0B/ADObDPw5cJ67N5jZA+l5nci8Hlb6quQJjv27/1NgJ6kjsRhwOKN//1CDSI/TqTaR7HsJuD7csKuU1O2wXwf+i9SN+WJmNobUxUTT1gHTwvQQ4ADQGPpd1cF2YqQubgnwB2H9JzIUqA1HXJ8jdXHZtOnAmi7sm0i36YhHJPt+Ser7m1WkjkL+0t13mNnjwGWk3uA3kLoLZmNY5mlSQfRbd19lZm8Ba4FNwCsdbOcAcLaZvRnWc30ndf0IeNzMrgOWh+XTPhpqEOlxujq1SITMbJC77zezkaSOgi4MoTSAVBhcGL4b6sq69rv7oB6q6yVgobs39MT6RDLpiEckWk+FG3mVAN9x9x0A7n7IzO4ExgPVuSwonA78gUJHskVHPCIiklMaXCAiIjml4BERkZxS8IiISE4peEREJKcUPCIiklP/H5ng/JsZ6LsjAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is 12.83339468330072\n"
     ]
    }
   ],
   "source": [
    "mses = np.mean(lasso.mse_path_,axis = 1)\n",
    "plt.plot(np.log10(lasso.alphas_), mses)\n",
    "\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "print('alpha is',lasso.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "      <th>coef_lasso</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>20</td>\n",
       "      <td>log_cnt</td>\n",
       "      <td>2450.468974</td>\n",
       "      <td>1177.204024</td>\n",
       "      <td>2030.024154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>6</td>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>907.323457</td>\n",
       "      <td>526.180339</td>\n",
       "      <td>553.440886</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>19</td>\n",
       "      <td>log_registered</td>\n",
       "      <td>299.548489</td>\n",
       "      <td>1159.294001</td>\n",
       "      <td>594.695496</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>18</td>\n",
       "      <td>log_casual</td>\n",
       "      <td>193.744087</td>\n",
       "      <td>427.929591</td>\n",
       "      <td>198.719632</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>temp</td>\n",
       "      <td>148.470881</td>\n",
       "      <td>109.382039</td>\n",
       "      <td>170.201014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>12</td>\n",
       "      <td>weekday_1</td>\n",
       "      <td>64.319952</td>\n",
       "      <td>32.047768</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>14</td>\n",
       "      <td>weekday_3</td>\n",
       "      <td>60.444030</td>\n",
       "      <td>73.461370</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>17</td>\n",
       "      <td>weekday_6</td>\n",
       "      <td>48.565092</td>\n",
       "      <td>47.551855</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>10</td>\n",
       "      <td>workingday_1</td>\n",
       "      <td>38.199271</td>\n",
       "      <td>54.693586</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>8</td>\n",
       "      <td>holiday_1</td>\n",
       "      <td>33.108645</td>\n",
       "      <td>7.936456</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>atemp</td>\n",
       "      <td>-8.366413</td>\n",
       "      <td>43.957278</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>16</td>\n",
       "      <td>weekday_5</td>\n",
       "      <td>-9.270087</td>\n",
       "      <td>-30.003288</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>13</td>\n",
       "      <td>weekday_2</td>\n",
       "      <td>-17.576071</td>\n",
       "      <td>-4.597720</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>15</td>\n",
       "      <td>weekday_4</td>\n",
       "      <td>-26.609906</td>\n",
       "      <td>-8.278089</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>windspeed</td>\n",
       "      <td>-32.633695</td>\n",
       "      <td>-31.558271</td>\n",
       "      <td>-5.465366</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>7</td>\n",
       "      <td>holiday_0</td>\n",
       "      <td>-33.108645</td>\n",
       "      <td>-7.936456</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>workingday_0</td>\n",
       "      <td>-38.199271</td>\n",
       "      <td>-54.693586</td>\n",
       "      <td>-0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>hum</td>\n",
       "      <td>-64.662160</td>\n",
       "      <td>-45.152108</td>\n",
       "      <td>-14.830956</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>weekday_0</td>\n",
       "      <td>-119.873009</td>\n",
       "      <td>-110.181896</td>\n",
       "      <td>-59.078905</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>-407.409636</td>\n",
       "      <td>-200.491885</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>-499.913821</td>\n",
       "      <td>-325.688454</td>\n",
       "      <td>-134.883925</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           columns      coef_lr   coef_ridge   coef_lasso\n",
       "20         log_cnt  2450.468974  1177.204024  2030.024154\n",
       "6     weathersit_3   907.323457   526.180339   553.440886\n",
       "19  log_registered   299.548489  1159.294001   594.695496\n",
       "18      log_casual   193.744087   427.929591   198.719632\n",
       "0             temp   148.470881   109.382039   170.201014\n",
       "12       weekday_1    64.319952    32.047768     0.000000\n",
       "14       weekday_3    60.444030    73.461370     0.000000\n",
       "17       weekday_6    48.565092    47.551855     0.000000\n",
       "10    workingday_1    38.199271    54.693586     0.000000\n",
       "8        holiday_1    33.108645     7.936456     0.000000\n",
       "1            atemp    -8.366413    43.957278     0.000000\n",
       "16       weekday_5    -9.270087   -30.003288    -0.000000\n",
       "13       weekday_2   -17.576071    -4.597720    -0.000000\n",
       "15       weekday_4   -26.609906    -8.278089    -0.000000\n",
       "3        windspeed   -32.633695   -31.558271    -5.465366\n",
       "7        holiday_0   -33.108645    -7.936456    -0.000000\n",
       "9     workingday_0   -38.199271   -54.693586    -0.000000\n",
       "2              hum   -64.662160   -45.152108   -14.830956\n",
       "11       weekday_0  -119.873009  -110.181896   -59.078905\n",
       "4     weathersit_1  -407.409636  -200.491885     0.000000\n",
       "5     weathersit_2  -499.913821  -325.688454  -134.883925"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fs = pd.DataFrame({\"columns\":list(feat_names),\"coef_lr\":list((lr.coef_.T)),\"coef_ridge\":list((ridge.coef_.T)),\"coef_lasso\":list((lasso.coef_.T))})\n",
    "fs.sort_values(by = ['coef_lr'],ascending = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#岭回归系数收缩"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
